package ceha.util;

import ceha.application.CEHALogin;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JFrame;

public class Mysql extends JFrame {

    public JFrame ceha;
    private CEHALogin adminParam;
    private String message;

    public Mysql(CEHALogin adminparam) {
        this.adminParam = adminparam;
    }

    public String getMessage() {
        return message;
    }

    public Connection Connect() throws IOException {
        String url = "jdbc:mysql://localhost:3306/";
        String dbName = "ceha";
        String driver = "com.mysql.jdbc.Driver";
        String userName = "root";
        String password = "";
        Connection conn = null;
        try {
            Class.forName(driver).newInstance();
            conn = DriverManager.getConnection(url + dbName, userName, password);
        } catch (Exception e) {
            e.printStackTrace();
            
//            this.message =" Démarrez la base Mysql ! ";
//            new OkDialog(this,true).setVisible(true);

//            Runtime runtime = Runtime.getRuntime();
//            runtime.exec(new String[]{adminParam.getMysqlField()});

        }
        return conn;
    }
}
